package utils

import (
	"fmt"
	"github.com/astaxie/beego/config"
)

var(

	G_server_name string //项目名称
	G_server_addr string //服务器ip地址
	G_server_port string //服务器端口
	G_redis_addr string //redis ip地址
	G_redis_port string //redis port地址
	G_redis_dbnum string //redis db编号
	G_mysql_addr string //mysql ip地址
	G_mysql_port string //mysql port端口
	G_mysql_dbname string //mysql dbname
	G_fastdfs_port string // fastdfs 端口
	G_fastdfs_addr string //fastdfs ip

)

func InitConfig(){
	//从配置文件读取【位置信息
	appconf,err := config.NewConfig("ini","./conf/app.conf")
	if err !=nil{
		//beego.Debug(err)
		fmt.Println(err)
		return 
	}

	G_server_name  = appconf.String("appname")
	G_server_addr  = appconf.String("httpaddr")
	G_server_port  = appconf.String("httpport")
	G_redis_addr   = appconf.String("redisaddr")
	G_redis_port   = appconf.String("redisport")
	G_redis_dbnum  = appconf.String("redisdbnum")
	G_mysql_addr   = appconf.String("mysqladdr")
	G_mysql_port   = appconf.String("mysqport")
	G_mysql_dbname = appconf.String("mysqldbname")
	G_fastdfs_port = appconf.String("fastdfsport")
	G_fastdfs_addr = appconf.String("fastdfsaddr")

	return
}

func init(){
	InitConfig()
}

